<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/24 0024
 * Time: 16:04
 */
$desctions = [
    0 => ['pipe', 'r'],
    1 => ['pipe', 'w'],
    2 => ["file", "./error-output.txt", "a"]
];
$process = proc_open('php', $desctions, $pipes);

if (is_resource($process)) {
    fputs($pipes[0], '<?php echo "hello you\n";?>');
    fclose($pipes[0]);
    while (!feof($pipes[1])) {
        $line = fgets($pipes[1]);
        echo $line;
    }
    proc_close($process);
}